﻿using Infra.CustomException;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Web;
using WebApplication.Resources;

namespace WebApplication.Utils
{
    public class ControllerException : Exception, IExceptionForShow
    {
        public readonly Exception _exception;

        public ControllerException(Exception ex)
        {
            this._exception = ex;
        }

        public ControllerException(string message)
            : this(new Exception(message))
        {
            this.MessageKey = message;
        }

        public string MessageKey
        {
            protected set;
            get;
        }

        public string GetMessage(CultureInfo culture)
        {
            return MessageResource.ResourceManager.GetString(this.MessageKey, culture);
        }
    }
}